package com.mail.io;

import java.io.ByteArrayOutputStream;
import java.io.InputStream;

/**
 * A ByteArrayOutputStream that allows us to share the byte array rather than
 * copy it. Eventually could replace this with something that doesn't require a
 * single contiguous byte array.
 */
public class SharedByteArrayOutputStream extends ByteArrayOutputStream {
	public SharedByteArrayOutputStream(int size) {
		super(size);
	}

	public InputStream toStream() {
		return new SharedByteArrayInputStream(buf, 0, count);
	}
}